<template>
  <div class="examlist_container">
    <div class="title">
      <h2> 法治思维 快乐学法</h2>
    </div>
    <div class="typeSelect">
      <h3>
        考试记录
      </h3>
    </div>
    <div class="examlist toplist">
      <div class="examInfo">

        <table border="1" style="width: 100%" class="recordItem">

          <thead>
            <tr>
              <th>测试时间</th>
              <th>查看详情</th>
              <th>分数</th>
              <th>用时</th>
            </tr>

          </thead>
          <tbody>
            <tr v-for="item in tableData" :key="item.id">
              <td class="time">{{item.createTime}}</td>
              <td class="details" @click="toDetails(item)">查看详情</td>
              <td>{{item.totalPoint}}</td>
              <td>{{item.examTime}}</td>
            </tr>

          </tbody>
        </table>
      </div>

    </div>
    <div class="hr" style="height:100px"></div>
    <div class="step">
      <van-button round type="info" @click="toIndex()">返回</van-button>
    </div>
  </div>
</template>
<style scoped>
</style>
<script>
import path from '@/network'
import { Toast } from 'vant';
export default {
  name: 'App',

  data () {
    return {
      examInfo: null,//考试详情
      total: 0,
      pagesize: 50,
      currentPage: 1,
      tableData: [],
    };
  },

  created () {
  },

  mounted () {
    this.queryRecord()
  },
  methods: {
    //获取list
    queryRecord () {
      path.queryRecord({
        examId: this.$route.query.id,
        page: this.currentPage,
        pageSize: this.pagesize,
      }).then(res => {
        if (res.success === 0) {
          this.tableData = res.rows.examRecord,
            this.total = res.total;
        }

      })
    },

    toDetails: function (item) {
      this.$router.push({ name: 'recordDetails', query: { recordId: item.id, examId: this.$route.query.id, } })
    },

    toIndex: function () {
      this.$router.push({ name: "index" });
    },

  },
};


</script>